<template>
  <div class="mode-options">
    <div
      :key="index"
      @click="onItemClick(item)"
      class="mode-options-item"
      v-for="(item, index) in dataSource"
    >
      <img :src="item.icon" alt class="mode-options-item-icon" srcset />
      <p class="mode-options-item-title">{{item.title}}</p>
    </div>
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      // 数据源
      dataSource: [
        {
          id: '1',
          icon: require('@img/jingDongChaoShi.png'),
          title: '京东超市'
        },
        {
          id: '2',
          icon: require('@img/haiTunQuanQiu.png'),
          title: '海屯全球'
        },
        {
          id: '3',
          icon: require('@img/jingDongFuShi.png'),
          title: '京东服饰'
        },
        {
          id: '4',
          icon: require('@img/jingDongShengXian.png'),
          title: '京东生鲜'
        },
        {
          id: '5',
          icon: require('@img/jingDongDaoJia.png'),
          title: '京东到家'
        },
        {
          id: '6',
          icon: require('@img/chongZhiJiaoFei.png'),
          title: '充值缴费'
        },
        {
          id: '7',
          icon: require('@img/jingDongPinGou.png'),
          title: '9.9元拼'
        },
        {
          id: '8',
          icon: require('@img/lingJuan.png'),
          title: '领劵'
        },
        {
          id: '9',
          icon: require('@img/zhuanQian.png'),
          title: '赚钱'
        },
        {
          id: '10',
          icon: require('@img/quanBu.png'),
          title: '全部'
        }
      ]
    }
  },
  methods: {
    onItemClick: function (item) {
      this.$router.push({
        name: 'goodsList',
        params: {
          routerType: 'push'
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import '@css/style.scss';
.mode-options {
  display: flex;
  flex-wrap: wrap;
  background-color: white;
  padding-bottom: 14px;
  &-item {
    width: 20%;
    text-align: center;
    margin-top: 10px;

    &-icon {
      width: 40px;
      height: 40px;
    }

    &-title {
      font-size: $minInfoSize;
      margin-top: 6px;
    }
  }
}
</style>
